﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;

using NP.BPMReportPlatform.Samples.Dtos;

namespace NP.BPMReportPlatform.Samples
{
    public class SampleAppService : BPMReportPlatformAppService, ISampleAppService
    {
        public Task<SampleDto> GetAsync()
        {
            return Task.FromResult(
                new SampleDto
                {
                    Value = 42
                }
            );
        }

        public Task<SampleDto> GetAuthorizedAsync()
        {
            return Task.FromResult(
                new SampleDto
                {
                    Value = 42
                }
            );
        }

        public Task<List<DemoDto>> GetDemoPagesAsync()
        {
            var rd = new Random();
            var i = rd.Next(20, 50);

            var result = new List<DemoDto>();

            for (int j = 1; j <= i; j++)
            {
                result.Add(new DemoDto(rd.Next(0, 10000)));
            }
            return Task.FromResult(result);
        }
    }
}